<!--#include("header.html")-->
<!--%import("filter/generate_coupon.xml")-->
<!--%import("filter/delete_coupon.xml")-->

<!--// datepicker javascript plugin load -->
<!--%load_js_plugin("ui.datepicker")-->

<form action="./" method="post" onsubmit="return procFilter(this, insert_config)">
    <table cellspacing="0" class="rowTable">
    <tr>
        <th scope="row" class="w150"><div>{$lang->use_coupon}</div></th>
        <td>
            <select name="use_coupon">
                <option value="N"<!--@if($config->use_coupon=='N')--> selected="selected"<!--@end-->>{$lang->notuse}</option>
                <option value="Y"<!--@if($config->use_coupon=='Y')--> selected="selected"<!--@end-->>{$lang->use}</option>
            </select>
            <p>{$lang->about_use_coupon}</p>
        </td>
    </tr>
    <tr>
        <th scope="row" class="w150"><div>{$lang->coupon_var_name}</div></th>
        <td>
            <input type="type=" name="coupon_var_name" class="inputTypeText w100" value="{$config->coupon_var_name}" />
            <p>{$lang->about_coupon_var_name}</p>
        </td>
    </tr>
    <tr>
        <th colspan="2" class="button">
            <span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
        </th>
    </tr>
    </table>
</form>

<form action="./" method="post" onsubmit="return procFilter(this, generate_coupon)">
    <table cellspacing="0" class="rowTable">
    <tr>
        <th scope="row" class="w150"><div>{$lang->generate_coupon}</div></th>
        <td>
            <input type="type=" name="count" class="inputTypeText w40" /> {$lang->unit_number},
            
            <label>{$lang->receive_point} : <input type="type=" name="point" class="inputTypeText w40" maxlength="10" /></label>,
            
            <label for="validate_input">{$lang->validdate} : </label>
            <input type="hidden" name="validdate" id="date_validdate" value="" />
            <input id="validate_input" type="text" value="" readonly="readonly" class="inputDate inputTypeText" />
            
            <p>{$lang->about_generate_coupon}</p>
        </td>
    </tr>
    <tr>
        <th colspan="2" class="button">
            <span class="button black strong"><input type="submit" value="{$lang->cmd_make}" accesskey="s" /></span>
        </th>
    </tr>
    </table>
</form>

<!-- 삭제를 위한 임시 form -->
<form id="fo_coupon" action="./" method="get">
    <input type="hidden" name="coupon_srls" value="" />
</form>

<form action="./" method="get" id="coupon_list">
    <input type="hidden" name="module" value="admin" />
    <input type="hidden" name="act" value="{$act}" />
    <select name="joindate">
        <option value="">{$lang->my_view_all}</option>
        <option value="-" <!--@if($joindate=="-")-->selected="selected"<!--@end-->>{$lang->view_not_use}</option>
    </select>
    <span class="button green"><input type="submit" value="{$lang->view}" /></span>
    <table cellspacing="0" class="rowTable">
    <tr>
        <th scope="col"><div><input type="checkbox" onclick="XE.checkboxToggleAll(); return false;" /></div></th>
        <th scope="col"><div>{$lang->no}</div></th>
        <th scope="col"><div>{$lang->coupon_code}</div></th>
        <th scope="col"><div>{$lang->receive_point}</div></th>
        <th scope="col"><div>{$lang->regdate}</div></th>
        <th scope="col"><div>{$lang->validdate}</div></th>
        <th scope="col"><div>{$lang->invitation_join_id}</div></th>
        <th scope="col"><div>{$lang->invitation_joindate}</div></th>
        <th scope="col"><div>&nbsp;</div></th>
    </tr>
    <!--@foreach($coupon_list as $no => $val)-->
    <tr>
        <td class="center"><input type="checkbox" name="cart" value="{$val->coupon_srl}" /></td>
        <td>{$no}</td>
        <td style="font-family: monospace">{$val->code}</td>
        <td>{$val->point}</td>
        <td>{zdate($val->regdate,"Y-m-d")}</td>
        <td>{zdate($val->validdate,"Y-m-d")}</td>
        <td>{$val->join_id}</td>
        <td>{zdate($val->joindate,"Y-m-d")}</td>
        <td><a href="#" onclick="doDeleteCoupon('{$val->coupon_srl}');return false;" title="{htmlspecialchars($lang->cmd_delete)}" class="buttonSet buttonDelete"><span>{$lang->cmd_delete}</span></a></td>
    </tr>
    <!--@end-->
    </table>
</form>
<div class="fl">
    <a href="#" onclick="doDeleteCoupons();return false;" class="button red"><span>{$lang->cmd_delete}</span></a>
</div>

<!-- 페이지 네비게이션 -->
<div class="pagination a1">
    <a href="{getUrl('page','')}" class="prevEnd">{$lang->first_page}</a> 
    <!--@while($page_no = $page_navigation->getNextPage())-->
        <!--@if($page == $page_no)-->
            <strong>{$page_no}</strong> 
        <!--@else-->
            <a href="{getUrl('page',$page_no)}">{$page_no}</a> 
        <!--@end-->
    <!--@end-->
    <a href="{getUrl('page',$page_navigation->last_page)}" class="nextEnd">{$lang->last_page}</a>
</div>

<script type="text/javascript">
(function($){
    $(function(){
        var option = { changeMonth: true, changeYear: true, gotoCurrent: false,yearRange:'-100:+10', onSelect:function(){

            $(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))}
        };
        $.extend(option,$.datepicker.regional['{$lang_type}']);
        $(".inputDate").datepicker(option);
    });
})(jQuery);
</script>